package facilius.controller.action.tiponota;

import facilius.model.ServiceLocator;
import facilius.model.pojo.TipoNota;
import org.mentawai.core.BaseAction;
import org.mentawai.validation.Validatable;

/**
 *
 * @author Graciano
 */
public class TipoNotaCreateAction extends BaseAction{

    @Override
    public String execute() throws Exception {
        String consequence = ERROR;
        try {

            TipoNota tipoNota = new TipoNota();
            tipoNota.setDescricao(input.getString("descricao"));
            tipoNota.setOficial(input.getBoolean("oficial"));

            ServiceLocator.getTipoNotaService().create(tipoNota);
            consequence = SUCCESS;
        } catch (Exception e) {
            consequence = "EXCEPTION";
            e.printStackTrace();
        }

        return consequence;
    }
}
